broadway: Get query_state window coords from browser side
authorAlexander Larsson <alexl@redhat.com>
Fri, 11 Mar 2011 20:39:11 +0000 (21:39 +0100)
committerAlexander Larsson <alexl@redhat.com>
Fri, 11 Mar 2011 20:39:11 +0000 (21:39 +0100)
gdk/broadway/broadway.js
gdk/broadway/gdkdevice-broadway.c

index bed889f1f7ee678939d215e652921111ad6fbf73..17fb6a137bc380552c11d9e2665babcd953761f5 100644 (file)
@@ -247,7 +247,9 @@ function handleCommands(cmd_obj)
         var id = base64_16(cmd, i);
         i = i + 3;
 
-       send_input ("q", [last_x, last_y]);
+       var pos = getPositionsFromAbsCoord(last_x, last_y, id);
+
+       send_input ("q", [pos.root_x, pos.root_y, pos.win_x, pos.win_x, window_with_mouse]);
        break;
 
       default:
index b222d6854735acd304888689eae7c81b432634c3..e0a4dad44b2ea3c653984489e1f5c6cfe3ac14c9 100644 (file)
@@ -159,7 +159,7 @@ gdk_broadway_device_query_state (GdkDevice        *device,
   guint32 serial;
   GdkScreen *screen;
   char *reply;
-  gint device_root_x, device_root_y;
+  gint device_root_x, device_root_y, device_win_x, device_win_y, id;
 
   if (gdk_device_get_source (device) != GDK_SOURCE_MOUSE)
     return FALSE;
@@ -176,9 +176,6 @@ gdk_broadway_device_query_state (GdkDevice        *device,
   if (mask)
     *mask = 0; /* TODO */
 
-  device_root_x = broadway_display->last_x;
-  device_root_y = broadway_display->last_y;
-
   if (broadway_display->output)
     {
       impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
@@ -203,13 +200,37 @@ gdk_broadway_device_query_state (GdkDevice        *device,
          p++; /* Skip , */
          device_root_y = strtol(p, &p, 10);
          p++; /* Skip , */
-
+         device_win_x = strtol(p, &p, 10);
+         p++; /* Skip , */
+         device_win_y = strtol(p, &p, 10);
+         p++; /* Skip , */
+         id = strtol(p, &p, 10);
+
+         if (root_x)
+           *root_x = device_root_x;
+         if (root_y)
+           *root_y = device_root_y;
+         if (win_x)
+           *win_x = device_win_x;
+         if (win_y)
+           *win_y = device_win_y;
+         if (child_window)
+           {
+             if (gdk_window_get_window_type (window) == GDK_WINDOW_ROOT)
+               *child_window = g_hash_table_lookup (broadway_display->id_ht, GINT_TO_POINTER (id));
+             else
+               *child_window = window; /* No native children */
+           }
          g_free (reply);
+         return TRUE;
        }
     }
 
   /* Fallback when unconnected */
 
+  device_root_x = broadway_display->last_x;
+  device_root_y = broadway_display->last_y;
+
   if (root_x)
     *root_x = device_root_x;
   if (root_y)